package com.cndw.kungfu.domain;

import net.sf.json.JSONObject;
/**
 * 玩家称号 
 */
public class Title{
	private int id;
	/**
	 * 称号类型
	 */
	private int titleType;
	/**
	 * 名称
	 */
	private String titleName;
	/**
	 * 品质4普通（绿色）、3精良（蓝色）、2非凡（紫色）、1传说（橙色）
	 */
	private int quality;
	/**
	 * 达成条件类型
	 */
	private int requiresType;
	/**
	 * 达成条件
	 */
	private int requires;
	/**
	 * 达成需要条件的数量
	 */
	private int requireNum;
	/**
	 * 增加属性
	 */
	private String addAttri;
	/**
	 * 获取方式描述
	 */
	private String descri;
	/**
	 * 增加属性值
	 */
	private int[] attris;
	/**
	 * hide属性
	 */
	private int hide;
	
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public int getTitleType() {
		return titleType;
	}
	public void setTitleType(int titleType) {
		this.titleType = titleType;
	}
	public String getTitleName() {
		return titleName;
	}
	public void setTitleName(String titleName) {
		this.titleName = titleName;
	}
	public int getQuality() {
		return quality;
	}
	public void setQuality(int quality) {
		this.quality = quality;
	}
	public String getAddAttri() {
		return addAttri;
	}
	public void setAddAttri(String addAttri) {
		this.addAttri = addAttri;
	}
	public int getRequiresType() {
		return requiresType;
	}
	public void setRequiresType(int requiresType) {
		this.requiresType = requiresType;
	}
	public int getRequires() {
		return requires;
	}
	public void setRequires(int requires) {
		this.requires = requires;
	}
	public String getDescri() {
		return descri;
	}
	public void setDescri(String descri) {
		this.descri = descri;
	}
	public int[] getAttris() {
		return attris;
	}
	public int getRequireNum() {
		return requireNum;
	}
	public void setRequireNum(int requireNum) {
		this.requireNum = requireNum;
	}
	public int getHide() {
		return hide;
	}
	public void setHide(int hide) {
		this.hide = hide;
	}
	public void parse(){
		JSONObject jb = JSONObject.fromObject(addAttri);
		attris = new int[10];
		if(jb.containsKey("hit")){
			attris[1] = jb.getInt("hit");
		}
		if(jb.containsKey("dodge")){
			attris[2] += jb.getInt("dodge");
		}
		if(jb.containsKey("crit")){
			attris[3] = jb.getInt("crit");
		}
		if(jb.containsKey("tough")){
			attris[4] = jb.getInt("tough");
		}
		if(jb.containsKey("attack")){
			attris[5] = jb.getInt("attack");
		}
		if(jb.containsKey("defense")){
			attris[6] = jb.getInt("defense");
		}
		if(jb.containsKey("hp")){
			attris[7] = jb.getInt("hp");
		}
		if(jb.containsKey("mp")){
			attris[8] = jb.getInt("mp");
		}
		if(jb.containsKey("attackSpeed")){
			attris[9] = jb.getInt("attackSpeed");
		}
	}
}
